//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.yaukie.base.constant;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("返回结果")
public class BaseResult {
    @ApiModelProperty("返回状态编码")
    public int code;
    @ApiModelProperty("返回状态信息")
    public String msg;
    @ApiModelProperty("返回结果集")
    public Object data;
    @ApiModelProperty("成功标记")
    public boolean success;

    public BaseResult() {
        this.code = BaseResultConstant.SUCCESS.code;
        this.msg = BaseResultConstant.SUCCESS.message;
        this.data = null;
        this.success = true;
    }

    public BaseResult(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        if (code == BaseResultConstant.SUCCESS.code) {
            this.success = true;
        } else {
            this.success = false;
        }

    }

    public BaseResult(BaseResultConstant baseResultConstant, Object data) {
        this.code = baseResultConstant.code;
        this.msg = baseResultConstant.message;
        this.data = data;
        if (baseResultConstant.getCode() == BaseResultConstant.SUCCESS.code) {
            this.success = true;
        } else {
            this.success = false;
        }

    }

    public static BaseResult fail() {
        return new BaseResult(BaseResultConstant.FAILED, "");
    }

    public static BaseResult fail(Object data) {
        return new BaseResult(BaseResultConstant.FAILED, data);
    }

    public static BaseResult fail(String msg) {
        return new BaseResult(BaseResultConstant.FAILED.code, msg, (Object)null);
    }

    public static BaseResult success(Object data) {
        return new BaseResult(BaseResultConstant.SUCCESS, data);
    }

    public static BaseResult success() {
        return new BaseResult();
    }

    public static BaseResult success(String msg, Object data) {
        return new BaseResult(BaseResultConstant.SUCCESS.code, msg, data);
    }

    public void setbaseResultConstant(BaseResultConstant baseResultConstant) {
        this.code = baseResultConstant.code;
        this.msg = baseResultConstant.message;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getmsg() {
        return this.msg;
    }

    public void setmsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return this.data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean isSuccess() {
        return this.success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
}
